package com.xbongbong.saas.script.tempenum;


import com.xbongbong.paas.field.FieldAttrEntity;
import com.xbongbong.paas.field.SaasParticularAttributePoJo;
import com.xbongbong.saas.enums.RedundantTemplateTypeEnum;
import com.xbongbong.saas.enums.business.CompetitorAnalysisEnum;
import com.xbongbong.saas.enums.dictionary.CompetitorAfterServiceEnum;
import com.xbongbong.saas.enums.dictionary.CompetitorCustomerRelationshipEnum;
import com.xbongbong.saas.enums.dictionary.CompetitorProductExperienceEnum;
import com.xbongbong.saas.enums.dictionary.CompetitorProductFunctionEnum;
import com.xbongbong.saas.enums.dictionary.CompetitorQuotedPriceEnum;
import com.xbongbong.saas.script.help.InitExplainsHelper;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author: yingjf
 * @date: 2022/8/17 09:17
 * @description:
 */
@Getter
public enum TempCompetitorAnalysisEnum {
    //基本信息
    BASE_INFO(CompetitorAnalysisEnum.BASE_INFO),
    // 隐藏字段 竞争对手名称
    COMPETITOR_NAME_HIDE(CompetitorAnalysisEnum.COMPETITOR_NAME_HIDE),
    // 隐藏字段 客户名称
    CUSTOMER_NAME_HIDE(CompetitorAnalysisEnum.CUSTOMER_NAME_HIDE),
    // 隐藏字段 关联机会
    OPPORTUNITY_NAME_HIDE(CompetitorAnalysisEnum.OPPORTUNITY_NAME_HIDE),
    //竞争指标
    COMPETITIVE_INDICATORS(CompetitorAnalysisEnum.COMPETITIVE_INDICATORS),
    //威胁指数
    THREAT_INDEX(CompetitorAnalysisEnum.THREAT_INDEX),
    //报价
    QUOTED_PRICE(CompetitorAnalysisEnum.QUOTED_PRICE),
    //售后服务
    AFTER_SERVICE(CompetitorAnalysisEnum.AFTER_SERVICE),
    //产品功能
    PRODUCT_FUNCTION(CompetitorAnalysisEnum.PRODUCT_FUNCTION),
    //产品体验
    PRODUCT_EXPERIENCE(CompetitorAnalysisEnum.PRODUCT_EXPERIENCE),
    //客情关系
    CUSTOMER_RELATIONSHIP(CompetitorAnalysisEnum.CUSTOMER_RELATIONSHIP),
    ;

    private CompetitorAnalysisEnum anEnum;

    TempCompetitorAnalysisEnum(CompetitorAnalysisEnum anEnum){
        this.anEnum = anEnum;
    }



    public static List<TempCompetitorAnalysisEnum> getAllEnum() {
        List<TempCompetitorAnalysisEnum> list = new ArrayList<>();
        Collections.addAll(list, values());
        return list;
    }
    public static void initBaseInfo(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setEditHide(1);
        fieldAttrEntity.setShowAttrPermission(0);
    }
    public static void initCompetitorName(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setSort(1);
        fieldAttrEntity.setEditHide(1);

        fieldAttrEntity.setLinkedType(RedundantTemplateTypeEnum.COMPETITOR.getCode());
        fieldAttrEntity.setLinkedText(COMPETITOR_NAME_HIDE.anEnum.getAttr());
        SaasParticularAttributePoJo saasParticularAttributePoJo = new SaasParticularAttributePoJo();
        saasParticularAttributePoJo.setMultiCheck(false);
        saasParticularAttributePoJo.setRelyMode("competitor");
        saasParticularAttributePoJo.setRelyType("base");
        fieldAttrEntity.setSaasParticularAttributePoJo(saasParticularAttributePoJo);
        fieldAttrEntity.setIsForbidden(0);
    }

    public static void initCustomerName(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setSort(2);
        fieldAttrEntity.setEditHide(1);

        fieldAttrEntity.setLinkedType(RedundantTemplateTypeEnum.CUSTOMER.getCode());
        fieldAttrEntity.setLinkedText(CUSTOMER_NAME_HIDE.anEnum.getAttr());
        SaasParticularAttributePoJo saasParticularAttributePoJo = new SaasParticularAttributePoJo();
        saasParticularAttributePoJo.setMultiCheck(false);
        saasParticularAttributePoJo.setRelyMode("customer");
        saasParticularAttributePoJo.setRelyType("base");
        fieldAttrEntity.setSaasParticularAttributePoJo(saasParticularAttributePoJo);
        fieldAttrEntity.setIsForbidden(0);
    }

    public static void initOpportunityName(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setSort(3);
        fieldAttrEntity.setEditHide(1);

        fieldAttrEntity.setLinkedType(RedundantTemplateTypeEnum.SALES_OPPORTUNITY.getCode());
        fieldAttrEntity.setLinkedText(OPPORTUNITY_NAME_HIDE.anEnum.getAttr());
        SaasParticularAttributePoJo saasParticularAttributePoJo = new SaasParticularAttributePoJo();
        saasParticularAttributePoJo.setMultiCheck(false);
        saasParticularAttributePoJo.setRelyMode("opportunity");
        saasParticularAttributePoJo.setRelyType("base");
        fieldAttrEntity.setSaasParticularAttributePoJo(saasParticularAttributePoJo);
        fieldAttrEntity.setIsForbidden(0);
    }

    public static void initCompetitiveIndicators(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setEditHide(1);
        fieldAttrEntity.setShowAttrPermission(0);
    }
    public static void initThreatIndex(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setShowAttrPermission(0);
    }

    public static void initQuotedPrice(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setItems(InitExplainsHelper.setCombItemByEnum(CompetitorQuotedPriceEnum.class, fieldAttrEntity.getFieldType()));
        fieldAttrEntity.setDictionaryFlag(1);
        fieldAttrEntity.setShowAttrPermission(0);
        fieldAttrEntity.setNoItemLink(1);

    }

    public static void initAfterService(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setItems(InitExplainsHelper.setCombItemByEnum(CompetitorAfterServiceEnum.class, fieldAttrEntity.getFieldType()));
        fieldAttrEntity.setDictionaryFlag(1);
        fieldAttrEntity.setShowAttrPermission(0);
        fieldAttrEntity.setNoItemLink(1);

    }

    public static void initProductFunction(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setItems(InitExplainsHelper.setCombItemByEnum(CompetitorProductFunctionEnum.class, fieldAttrEntity.getFieldType()));
        fieldAttrEntity.setDictionaryFlag(1);
        fieldAttrEntity.setShowAttrPermission(0);
        fieldAttrEntity.setNoItemLink(1);

    }

    public static void initProductExperience(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setItems(InitExplainsHelper.setCombItemByEnum(CompetitorProductExperienceEnum.class, fieldAttrEntity.getFieldType()));
        fieldAttrEntity.setDictionaryFlag(1);
        fieldAttrEntity.setShowAttrPermission(0);
        fieldAttrEntity.setNoItemLink(1);
    }

    public static void initCustomerRelationship(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setItems(InitExplainsHelper.setCombItemByEnum(CompetitorCustomerRelationshipEnum.class, fieldAttrEntity.getFieldType()));
        fieldAttrEntity.setDictionaryFlag(1);
        fieldAttrEntity.setShowAttrPermission(0);
        fieldAttrEntity.setNoItemLink(1);
    }

}
